import request from "@/util/requestServerFile";
//获取所有项目服务空间
export function getAllFileSpace(data: any) {
  return request.get("/getspacelist", {
    params: data,
  });
}
//获取空间下文件列表
export function getFileServeFileList(data: any) {
  return request.get("/file-api/queryFileList", {
    params: data,
  });
}
//修改文件信息接口
export function updateFile(data: any) {
  return request.put("/file-api/updateFile", data);
}
//删除文件接口
export function deleteFile(data: any) {
  return request.delete("/file-api/delFile", {
    params: data,
  });
}
//上传文件接口（目前单文件）
export function addfile(formData: any, params: any = {}, callback: any) {
  return request.post("/file-api/addFile", formData, {
    params,
    onUploadProgress: (progressEvent: any) => {
      const percentNum = Math.round(
        (progressEvent.loaded * 100) / progressEvent.total
      );
      callback(percentNum);
    },
  });
}
//分片上传文件接口（目前单文件）
export function addBigFile(formData: any, params: any = {}, callback: any) {
  return request.post("/file-api/addBigFile", formData, {
    params,
    onUploadProgress: (progressEvent: any) => {
      const percentNum = Math.round(
        (progressEvent.loaded * 100) / progressEvent.total
      );
      callback(percentNum);
    },
  });
}
//新建项目空间接口
export function addfilespace(data: any) {
  return request.post("/addfilespace", data);
}
